package com.ty.controller;

import cn.hutool.core.bean.BeanUtil;
import com.ty.bean.AgentInquirySheet;
import com.ty.common.bean.PageBean;
import com.ty.common.bean.ResultBean;
import com.ty.common.controller.BaseController;
import com.ty.mapper.AgentInquirySheetMapper;
import com.ty.query.AgentInquirySheetQuery;
import com.ty.service.AgentInquirySheetInquiryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Api("货代订单")
@RestController
@RequestMapping("/api")

public class AgentInquirySheetController  extends BaseController {

    @Autowired
    AgentInquirySheetMapper sheetMapper;

    @ApiOperation("查询订单")
    @GetMapping("/sheet")
    public ResultBean get(@RequestParam("id") int id) {
        System.out.println(id);
        AgentInquirySheet sheet= sheetMapper.get(id);
        return success("订单信息", sheet);
    }

    @ApiOperation("查询订单列表")
    @PostMapping("/order/list")
    public ResultBean<PageBean<List<AgentInquirySheet>>> query(@RequestBody AgentInquirySheetQuery query) {
        PageBean bean = (PageBean) sheetMapper.queryByMap((AgentInquirySheetQuery) BeanUtil.beanToMap(query));
        return success("订单列表", bean);
    }


}
